<?php
namespace RestClient;

use GuzzleHttp\Psr7\Response;
use Firebase\JWT\JWT;
use Firebase\JWT\SignatureInvalidException;
use Firebase\JWT\BeforeValidException;

class RestResponse
{
    private $data;
    private $pagination;
    private $errors;
    private $response;


    public function __construct(Response $response)
    {
        $contents = $response->getBody()->getContents();
        $contents = json_decode($contents, true);
        $token = $contents['token'];
        try {
            // JWT::decode($token, );
            
        } catch (SignatureInvalidException $e) {
            dump($e);
        } catch (BeforeValidException $e) {
            dump($e);
        } catch (\Exception $e) {
            dump($e);
        }
        dump($contents);
    }

    public function getData()
    {
        return $this->data;
    }
    
}
